package com.mt.roll.process.controller;

import com.mt.roll.core.base.BaseController;
import com.mt.roll.core.constants.CommonConstant;
import com.mt.roll.core.params.IdParam;
import com.mt.roll.core.vo.IdListVo;
import com.mt.roll.core.vo.R;
import com.mt.roll.process.params.ProcessFlowEquipmentListParam;
import com.mt.roll.process.params.ProcessFlowEquipmentQueryParam;
import com.mt.roll.process.service.ProcessFlowEquipmentService;
import com.mt.roll.process.vo.EquipmentBomVo;
import com.mt.roll.process.vo.EquipmentRecipeVo;
import com.mt.roll.process.vo.EquipmentVo;
import com.mt.roll.process.vo.WorkSequenceEquipmentVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.groups.Default;
import java.util.List;

/**
 * @Author: liguanghao
 * @Date: 2020/12/30 14:24
 * @Version 1.0
 */
@RestController
@RequestMapping(CommonConstant.API_MODULE_PROCESS + "process-flow-equipment")
@Slf4j
@Api(value = "工艺设备点管理", tags = "工艺设备点管理", hidden = false)
public class ProcessFlowEquipmentController extends BaseController {
    @Autowired
    private ProcessFlowEquipmentService processFlowEquipmentService;
    @PostMapping(value = "list")
    @ApiOperation(value = "获取工艺设备点列表")
    private R<List<WorkSequenceEquipmentVo>> list(@Validated({Default.class}) @RequestBody ProcessFlowEquipmentQueryParam processFlowEquipmentQueryParam) {
        return processFlowEquipmentService.list(processFlowEquipmentQueryParam);
    }
    @PostMapping(value = "add")
    @ApiOperation(value = "新增工艺设备点")
    private R<IdListVo> add(@Validated({Default.class}) @RequestBody ProcessFlowEquipmentListParam processFlowEquipmentListParam){
        return processFlowEquipmentService.add(processFlowEquipmentListParam);
    }

    @PostMapping(value = "equipmentRecipeList")
    @ApiOperation(value = "获取设备配方列表")
    private R<List<EquipmentRecipeVo>> equipmentRecipeList(@Validated @RequestBody IdParam idParam) {
        return processFlowEquipmentService.equipmentRecipeList(idParam);
    }

    @PostMapping(value = "equipmentBomList")
    @ApiOperation(value = "获取设备bom列表")
    private R<List<EquipmentBomVo>> equipmentBomList(@Validated @RequestBody IdParam idParam ) {
        return processFlowEquipmentService.equipmentBomList(idParam);
    }

    @PostMapping(value = "allEquipmentRecipeList")
    @ApiOperation(value = "获取所有设备配方列表")
    private R<List<EquipmentRecipeVo>> allEquipmentRecipeList() {
        return processFlowEquipmentService.allEquipmentRecipeList();
    }

    @PostMapping(value = "allEquipmentBomList")
    @ApiOperation(value = "获取所有设备bom列表")
    private R<List<EquipmentBomVo>> allEquipmentBomList() {
        return processFlowEquipmentService.allEquipmentBomList();
    }

    @PostMapping(value = "equipmentList")
    @ApiOperation(value = "获取设备列表")
    private R<List<EquipmentVo>> equipmentList() {
        return processFlowEquipmentService.equipmentList();
    }
}

